﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace Siasun.AFC.RtPlatfromGui.UI.Converters
{
    class MenuIsCanUseValueConverters : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (object.Equals(null, value)) return "未检测到";
            bool result = false;
            bool.TryParse(value.ToString(), out result);

            if (result) return "可用";
            else return "禁用";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //throw new NotImplementedException();
            return null;
        }
    }

    class MenuIsCanUseShowConverters : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (object.Equals(null, value)) return Visibility.Visible;
            bool result = false;
            bool.TryParse(value.ToString(), out result);

            if (result) return Visibility.Collapsed;
            else return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //throw new NotImplementedException();
            return null;
        }
    }
}
